Motion compensation method and device using bidirectional optical flow

ABSTRACT

Disclosed herein is a method for adaptive bidirectional optical flow estimation for inter-screen prediction compensation during video encoding. The method aims to reduce complexity and/or cost of bidirectional optical flow (BIO) at a pixel level or a subblock level.

CROSS-REFERENCE TO RELATED APPLICATION

This present application is a continuation of U.S. patent applicationSer. No. 16/642,164, filed on Feb. 26, 2020, which is a national stagefiling under 35 U.S.C. § 371 of PCT application number PCT/KR2018/009940filed on Aug. 29, 2018 which is based upon and claims the benefit ofpriorities to Korean Patent Application No. 10-2017-0109632, filed onAug. 29, 2017 and Korean Patent Application No. 10-2017-0175587, filedon Dec. 19, 2017, in the Korean Intellectual Property Office, which areincorporated herein in their entireties by reference.

TECHNICAL FIELD

The present disclosure relates to image encoding or decoding. Morespecifically, the present disclosure relates to a bidirectional opticalflow for motion compensation.

BACKGROUND

The statements in this section merely provide background informationrelated to the present disclosure and may not constitute prior art.

In video encoding, compression is performed using data redundancy inboth spatial and temporal dimensions. Spatial redundancy is greatlyreduced by transform coding. Temporal redundancy is reduced throughpredictive coding. Observing that the time correlation is maximizedalong the motion trajectory, prediction for motion compensation is usedfor this purpose. In this context, the main purpose of motion estimationis not to find “real” motion in the scene, but to maximize compressionefficiency. In other words, the motion vector must provide accurateprediction of a signal. In addition, since motion information must betransmitted as overhead in a compressed bit stream, it must enable acompressed representation. Efficient motion estimation is important inachieving high compression in video encoding.

Motion is an important source of information in video sequences. Motionoccurs not only because of movement of an object but also because ofmovement of the camera. Apparent motion, also known as optical flow,captures spatio-temporal variations in pixel intensity in an imagesequence.

Bidirectional Optical Flow (BIO) is a motion estimation/compensationtechnique for motion refinement based on the assumption of optical flowand steady motion, which is disclosed in JCTVC-C204 and VCEG-AZ05 BIO.The bidirectional optical flow estimation method currently underdiscussion has an advantage on allowing fine correction of motion vectorinformation, but requires much higher computation complexity thanconventional bidirectional prediction for fine correction of motionvector information.

Non-Patent Document 1: JCTVC-C204 (E. Alshina, et al., Bi-directionaloptical flow, Joint Collaborative Team on Video Coding (JCT-VC) of ITU-TSG 16 WP 3 and ISO/IEC JTC 1/SC 29/WG 11, 3rd Meeting: Guangzhou, CN,7-15 October 2010)

Non-Patent Document 2: VCEG-AZ05 (E. Alshina, et al., Known toolsperformance investigation for next generation video coding, ITU-T SG 16Question 6, Video Coding Experts Group (VCEG), 52nd Meeting: 19-26 Jun.2015, Warsaw, Poland)

SUMMARY

It is an object of the present disclosure to reduce degradation of animage quality while reducing computation complexity of a bidirectionaloptical flow (BIO).

In accordance with one aspect of the present disclosure, provided is amethod for motion compensation using a bidirectional optical flow (BIO)in video encoding or decoding, the method including generating a firstreference block by a first motion vector referring to a first referencepicture and generating a second reference block by a second motionvector referring to a second reference picture; calculating a texturecomplexity of a current block using the first and second referenceblocks; and generating a prediction block of the current block based onthe first and second reference blocks by selectively applying orskipping the BIO process based on the texture complexity.

In accordance with another aspect of the present disclosure, provided isa device for performing motion compensation using a bidirectionaloptical flow (BIO) in video encoding or decoding, the device including areference block generator configured to generate a first reference blockby a first motion vector referring to a first reference picture andgenerate a second reference block by a second motion vector referring toa second reference picture; a skip determiner configured to calculate atexture complexity of a current block using the first and secondreference blocks and determine whether to skip a BIO process bycomparing the texture complexity with a threshold; and a predictionblock generator configured to generate a prediction block of the currentblock based on the first and second reference blocks by selectivelyapplying or skipping the BIO process based on the determination of theskip determiner.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is an exemplary block diagram of a video encoding apparatusaccording to an embodiment of the present disclosure;

FIG. 2 is an exemplary diagram of neighboring blocks of a current block;

FIG. 3 is an exemplary block diagram of a video decoding apparatusaccording to an embodiment of the present disclosure;

FIG. 4 is a reference diagram for explaining the basic concept of BIO;

FIG. 5 is an exemplary diagram of the shape of a mask centered on acurrent pixel in pixel-based BIO;

FIG. 6 is an exemplary diagram for explaining setting a luminance valueand a gradient for pixels at positions outside a reference block withina mask in a padding manner;

FIG. 7 is an exemplary diagram of the shape of a mask centered on asubblock in subblock-based BIO;

FIG. 8 is an exemplary diagram for explaining applying a mask on apixel-by-pixel basis in the subblock-based BIO;

FIG. 9 is an exemplary diagram of the shape of another mask centered ona subblock in the subblock-based BIO;

FIG. 10 is a block diagram illustrating a configuration of a deviceconfigured to perform motion compensation by selectively applying a BIOprocess according to an embodiment of the present disclosure;

FIG. 11 is an exemplary diagram illustrating a procedure of performingmotion compensation by selectively applying the BIO process based ontexture complexity of a current block according to an embodiment of thepresent disclosure;

FIG. 12 is another exemplary diagram illustrating a procedure ofperforming motion compensation by selectively applying the BIO processbased on texture complexity of a current block according to anembodiment of the present disclosure;

FIG. 13 is yet another exemplary diagram illustrating a procedure ofperforming motion compensation by selectively applying the BIO processbased on texture complexity of a current block according to anembodiment of the present disclosure;

FIG. 14 is an exemplary diagram illustrating a procedure of performingmotion compensation by selectively applying the BIO process based on thesize of a current block and an encoding mode of a motion vectoraccording to an embodiment of the present disclosure;

FIG. 15 is an exemplary diagram illustrating a procedure of performingmotion compensation by selectively applying the BIO process based on aCVC condition and a BCC condition according to an embodiment of thepresent disclosure; and

FIG. 16 is an exemplary diagram illustrating a procedure of performingmotion compensation by selectively applying the BIO process based on amotion vector variance of neighboring blocks according to an embodimentof the present disclosure.

DETAILED DESCRIPTION

Hereinafter, some embodiments of the present invention will be describedin detail with reference to the accompanying drawings. It should benoted that, in adding reference numerals to the constituent elements inthe respective drawings, like reference numerals designate likeelements, although the elements are shown in different drawings.Further, in the following description of the present invention, adetailed description of known functions and configurations incorporatedherein will be omitted when it may make the subject matter of thepresent invention rather unclear.

The techniques of the present disclosure generally relate to reducingcomplexity and/or cost of a bidirectional optical flow (BIO) technique.BIO may be applied during motion compensation. In general, the BIO isused to calculate a motion vector for each pixel or subblock in thecurrent block through an optical flow, and to update predicted values ofcorresponding pixels or subblocks based on the calculated motion vectorvalue for each pixel or subblock.

FIG. 1 is an exemplary block diagram of a video encoding apparatuscapable of implementing techniques of the present disclosure.

The video encoding apparatus includes a block splitter 110, a predictor120, a subtractor 130, a transformer 140, a quantizer 145, an encoder150, an inverse quantizer 160, an inverse transformer 165, an adder 170,a filter unit 180, and a memory 190. Each element of the video encodingapparatus may be implemented as a hardware chip, or may be implementedas software, and one or more microprocessors may be implemented toexecute the functions of the software corresponding to the respectiveelements.

The block splitter 110 splits each picture constituting video into aplurality of coding tree units (CTUs), and then recursively splits theCTUs using a tree structure. A leaf node in the tree structure is acoding unit (CU), which is a basic unit of coding. A QuadTree (QT)structure, in which a node (or a parent node) is split into foursub-nodes (or child nodes) of the same size, or a QuadTree plusBinaryTree (QTBT) structure combining the QT structure and a BinaryTree(BT) structure in which a node is split into two sub-nodes, may be usedas the tree structure. That is, QTBT may be used to split the CTU intomultiple CUs.

In the QuadTree plus BinaryTree (QTBT) structure, a CTU can be firstsplit according to the QT structure. The quadtree splitting may berepeated until the size of the splitting block reaches the minimum blocksize MinQTSize of the leaf node allowed in QT. If the leaf node of theQT is not greater than the maximum block size MaxBTSize of the root nodeallowed in the BT, it may be further partitioned into a BT structure.The BT may have a plurality of split types. For example, in someexamples, there may be two splitting types, which are a type ofhorizontally splitting a block of a node into two blocks of the samesize (i.e., symmetric horizontal splitting) and a type of verticallysplitting a block of a node into two blocks of the same size (i.e.,symmetric vertical splitting). Further, there may be a splitting type ofsplitting a block of a node into two blocks in an asymmetric form. Theasymmetric splitting may include splitting a block of a node into tworectangular blocks at a size ratio of 1:3, or splitting a block of anode in a diagonal direction.

The splitting information generated by the block splitter 110 bysplitting the CTU by the QTBT structure is encoded by the encoder 150and transmitted to the video decoding apparatus.

The CU may have various sizes depending on the QTBT splitting of theCTU. Hereinafter, a block corresponding to a CU (i.e., a leaf node ofthe QTBT) to be encoded or decoded is referred to as a “current block.”

The predictor 120 generates a prediction block by predicting a currentblock. The predictor 120 includes an intra-predictor 122 and aninter-predictor 124.

In general, current blocks within a picture may each be predictivelycoded. In general, prediction of the current blocks may be accomplishedusing an intra-prediction technique, which uses data from a picturecontaining the current blocks, or an inter-prediction technique, whichuses data from a picture coded before the picture containing the currentblocks. Inter-prediction includes both unidirectional prediction andbidirectional prediction.

For each inter-predicted block, a motion information set may beavailable. A set of motion information may include motion informationabout the forward and backward prediction directions. Here, the forwardand backward prediction directions are two prediction directions in abidirectional prediction mode, and the terms “forward direction” and“backward direction” do not necessarily have a geometric meaning.Instead, they generally correspond to whether to display a referencepicture before (“backward direction”) or after (“forward direction”) thecurrent picture. In some examples, the “forward” and “backward”prediction directions may correspond to reference picture list 0 (RefPicList0) and reference picture list 1 (RefPicList1) of the currentpicture.

For each prediction direction, the motion information includes areference index and a motion vector. The reference index may be used toidentify the reference picture in the current reference picture list(Ref PicList0 or Ref PicList1). The motion vector has a horizontalcomponent x and a vertical component y. In general, the horizontalcomponent represents horizontal displacement in the reference picturerelative to the position of the current blocks in the current picture,which is needed to locate the x coordinate of the reference block. Thevertical component represents a vertical displacement in the referencepicture relative to the position of the current blocks, which is neededto locate the y coordinate of the reference block.

The inter-predictor 124 generates a prediction block for the currentblock through a motion compensation procedure. The inter-predictor 124searches for a block most similar to the current block in a referencepicture encoded and decoded earlier than the current picture, andgenerates a prediction block for the current block using the searchedblock. Then, the inter-predictor generates a motion vector correspondingto a displacement between the current block in the current picture andthe prediction block in the reference picture. In general, motionestimation is performed on a luma component, and a motion vectorcalculated based on the luma component is used for both the lumacomponent and the chroma component. The motion information including theinformation about the reference picture and a motion vector used topredict the current block is encoded by the encoder 150 and transmittedto the video decoding apparatus.

In the case of bidirectional prediction, the inter-predictor 124 selectsa first reference picture and a second reference picture from referencepicture list 0 and reference picture list 1, respectively, and searchesfor a block similar to the current block in each of the referencepictures to generate a first reference block and a second referenceblock. Then, the inter-predictor 124 generates a prediction block forthe current block by averaging or weighted-averaging the first referenceblock and the second reference block. Then, the inter-predictortransmits, to the encoder 150, motion information including informationabout the two reference pictures and information about two motionvectors used to predict the current block. Here, the two motion vectorsrepresent a first motion vector corresponding to the displacementbetween the position of the current block in the current picture and theposition of the first reference block in the first reference picture(i.e., a motion vector referring to the first reference picture), and asecond motion vector corresponding to the displacement between theposition of the current block in the current picture and the position ofthe second reference block in the second reference picture (i.e., amotion vector referring to the second reference picture).

In addition, the inter-predictor 124 may perform a bidirectional opticalflow (BIO) process of the present disclosure to generate a predictionblock of the current block through bidirectional prediction. In otherwords, after determining bidirectional motion vectors for the currentblock, the inter-predictor 124 may generate a prediction block for thecurrent block by motion compensation according the BIO process on a perimage pixel basis or a per subblock basis. In other examples, one ormore other units of the encoding apparatus may be additionally involvedin carrying out the BIO process of the present disclosure. In addition,since the BIO process is performed by applying an explicit equationusing pre-decoded information shared between the encoding apparatus andthe decoding apparatus, signaling of additional information for the BIOprocess is not required.

In motion compensation by bidirectional prediction, whether to apply theBIO process may be determined in various ways. Details of the BIOprocess and details of whether to apply the BIO process in the motioncompensation procedure will be described with reference to FIG. 4 andsubsequent drawings.

Various methods may be used to minimize the number of bits required toencode motion information.

For example, when the reference picture and the motion vector of thecurrent block are the same as the reference picture and the motionvector of a neighboring block, the motion information about the currentblock may be transmitted to the decoding apparatus by encodinginformation for identifying the neighboring block. This method is calleda “merge mode.”

In the merge mode, the inter-predictor 124 selects a predeterminednumber of merge candidate blocks (hereinafter referred to as “mergecandidates”) from among the neighboring blocks of the current block.

As illustrated in FIG. 2 , as neighboring blocks for deriving mergecandidates, all or part of a left block L, an above block A, an aboveright block AR, a bottom left block BL, and an above left block AL whichare adjacent to the current block in the current picture may be used. Inaddition, a block located within a reference picture (which may be thesame as or different from the reference picture used to predict thecurrent block) other than the current picture in which the current blockis located may be used as a merge candidate. For example, a co-locatedblock which is at the same position as the current block or blocksadjacent to the co-located block in the reference picture may also beused as merge candidates.

The inter-predictor 124 configures a merge list including apredetermined number of merge candidates using such neighboring blocks.A merge candidate to be used as the motion information about the currentblock are selected from among the merge candidates included in the mergelist, and merge index information for identifying the selected candidateis generated. The generated merge index information is encoded by theencoder 150 and transmitted to the decoding apparatus.

Another method of encoding the motion information is to encode motionvector differences.

In this method, the inter-predictor 124 derives predictive motion vectorcandidates for a motion vector of the current block, using neighboringblocks of the current block. As neighboring blocks used to derive thepredictive motion vector candidates, all or part of a left block L, anabove block A, an above right block AR, a bottom left block BL, and anabove left block AL which are adjacent to the current block in thecurrent picture may be used as shown in FIG. 2 . In addition, blockslocated within a reference picture (which may be the same as ordifferent from the reference picture used to predict the current block)other than the current picture in which the current block is located maybe used as the neighboring blocks used to derive the predictive motionvector candidates. For example, a co-located block which is at the sameposition as the current block or blocks adjacent to the co-located blockin the reference picture may be used.

The inter-predictor 124 derives predictive motion vector candidatesusing the motion vectors of the neighboring blocks, and determines apredictive motion vector for the motion vector of the current blockusing the predictive motion vector candidates. Then, a motion vectordifference is calculated by subtracting the predictive motion vectorfrom the motion vector of the current block.

The predictive motion vector may be obtained by applying a predefinedfunction (e.g., a function for calculating a median, an average, or thelike) to the predictive motion vector candidates. In this case, thevideo decoding apparatus also knows the predefined function. Since theneighboring blocks used to derive the predictive motion vectorcandidates have already been encoded and decoded, the video decodingapparatus already knows the motion vectors of the neighboring blocks aswell. Accordingly, the video encoding apparatus does not need to encodeinformation for identifying the predictive motion vector candidates.Therefore, in this case, the information about the motion vectordifference and the information about the reference picture used topredict the current block are encoded.

The predictive motion vector may be determined by selecting any one ofthe predictive motion vector candidates. In this case, information foridentifying the selected predictive motion vector candidate is furtherencoded along with the information about the motion vector differenceand the information about the reference picture used to predict thecurrent block.

The intra-predictor 122 predicts pixels in the current block usingpixels (reference pixels) located around the current block in thecurrent picture in which the current block is included. There is aplurality of intra-prediction modes according to the predictiondirections, and the reference pixels and the equation to be used aredefined differently according to each prediction mode. In particular,the intra-predictor 122 may determine an intra-prediction mode to beused in encoding the current block. In some examples, theintra-predictor 122 may encode the current block using severalintra-prediction modes and select an appropriate intra-prediction modeto use from among the tested modes. For example, the intra-predictor 122may calculate rate distortion values using rate-distortion analysis ofseveral tested intra-prediction modes, and may select anintra-prediction mode that has the best rate distortion characteristicsamong the tested modes.

The intra-predictor 122 selects one intra-prediction mode from among theplurality of intra-prediction modes, and predicts the current blockusing neighboring pixels (reference pixels) and an equation determinedaccording to the selected intra-prediction mode. Information about theselected intra-prediction mode is encoded by the encoder 150 andtransmitted to the video decoding apparatus.

The subtractor 130 subtracts the prediction block generated by theintra-predictor 122 or the inter-predictor 124 from the current block togenerate a residual block.

The transformer 140 transforms residual signals in the residual blockhaving pixel values in the spatial domain into transform coefficients inthe frequency domain. The transformer 140 may transform the residualsignals in the residual block by using the size of the current block asa transform unit, or may split the residual block into a plurality ofsmaller subblocks and transform residual signals in transform unitscorresponding to the sizes of the subblocks. There may be variousmethods of splitting the residual block into smaller subblocks. Forexample, the residual block may be split into subblocks of the samepredefined size, or may be split in a manner of a quadtree (QT) whichtakes the residual block as a root node.

The quantizer 145 quantizes the transform coefficients output from thetransformer 140 and outputs the quantized transform coefficients to theencoder 150.

The encoder 150 encodes the quantized transform coefficients using acoding scheme such as CABAC to generate a bitstream. The encoder 150encodes information such as a CTU size, a MinQTSize, a MaxBTSize, aMaxBTDepth, a MinBTSize, a QT split flag, a BT split flag, and a splittype, which are associated with the block split, such that the videodecoding apparatus splits the block in the same manner as in the videoencoding apparatus.

The encoder 150 encodes information about a prediction type indicatingwhether the current block is encoded by intra-prediction orinter-prediction, and encodes intra-prediction information orinter-prediction information according to the prediction type.

When the current block is intra-predicted, a syntax element for theintra-prediction mode is encoded as intra-prediction information. Whenthe current block is inter-predicted, the encoder 150 encodes a syntaxelement for inter-prediction information. The syntax element forinter-prediction information includes the following information.

(1) Mode information indicating whether motion information about thecurrent block is encoded in a merge mode or a mode for encoding a motionvector difference.

(2) Syntax element for motion information

When motion information is encoded in the merge mode, the encoder 150may encode, as a syntax element for the motion information, merge indexinformation indicating which merge candidate is selected as a candidatefor extracting motion information about the current block from among themerge candidates.

On the other hand, when the motion information is encoded in the modefor encoding the motion vector difference, the information about themotion vector difference and the information about the reference pictureare encoded as syntax elements for the motion information. When thepredictive motion vector is determined in a manner of selecting one of aplurality of predictive motion vector candidates, the syntax element forthe motion information further includes predictive motion vectoridentification information for identifying the selected candidate.

The inverse quantizer 160 inversely quantizes the quantized transformcoefficients output from the quantizer 145 to generate transformcoefficients. The inverse transformer 165 transforms the transformcoefficients output from the inverse quantizer 160 from the frequencydomain to the spatial domain and reconstructs the residual block.

The adder 170 adds the reconstructed residual block to the predictionblock generated by the predictor 120 to reconstruct the current block.The pixels in the reconstructed current block are used as referencesamples in performing intra-prediction of the next block in order.

The filter unit 180 deblock-filters the boundaries between thereconstructed blocks in order to remove blocking artifacts caused byblock-by-block encoding/decoding and stores the blocks in the memory190. When all the blocks in one picture are reconstructed, thereconstructed picture is used as a reference picture forinter-predicting blocks in a subsequent picture to be encoded.

Hereinafter, a video decoding apparatus will be described.

FIG. 3 is an exemplary block diagram of a video decoding apparatuscapable of implementing techniques of the present disclosure.

The video decoding apparatus includes a decoder 310, an inversequantizer 320, an inverse transformer 330, a predictor 340, an adder350, a filter unit 360, and a memory 370. As in the case of the videoencoding apparatus of FIG. 2 , each element of the video encodingapparatus may be implemented as a hardware chip, or may be implementedas software, and the microprocessor may be implemented to execute thefunctions of the software corresponding to the respective elements.

The decoder 310 decodes a bitstream received from the video encodingapparatus, extracts information related to block splitting to determinea current block to be decoded, and extracts prediction informationnecessary to reconstruct the current block and information about aresidual signal.

The decoder 310 extracts information about the CTU size from thesequence parameter set (SPS) or the picture parameter set (PPS),determines the size of the CTU, and splits a picture into CTUs of thedetermined size. Then, the decoder determines the CTU as the uppermostlayer, that is, the root node, of a tree structure, and extractssplitting information about the CTU to split the CTU using the treestructure. For example, when the CTU is split using a QTBT structure, afirst flag (QT_split_flag) related to splitting of the QT is extractedto split each node into four nodes of a sub-layer. For a nodecorresponding to the leaf node of the QT, a second flag (BT_split_flag)and the split type information related to splitting of the BT areextracted to split the leaf node into a BT structure.

Upon determining a current block to be decoded through splitting of thetree structure, the decoder 310 extracts information about theprediction type indicating whether the current block is intra-predictedor inter-predicted.

When the prediction type information indicates intra-prediction, thedecoder 310 extracts a syntax element for the intra-predictioninformation (intra-prediction mode) about the current block.

When the prediction type information indicates inter-prediction, thedecoder 310 extracts a syntax element for the inter-predictioninformation. First, the decoder extracts mode information indicating anencoding mode in which the motion information about the current block isencoded among a plurality of encoding modes. Here, the plurality ofencoding modes includes a merge mode and a motion vector differenceencoding mode. When the mode information indicates the merge mode, thedecoder 310 extracts, as the syntax element for the motion information,merge index information indicating a merge candidate from which themotion vector of the current block is to be derived among the mergecandidates. On the other hand, when the mode information indicates themotion vector difference encoding mode, the decoder 310 extracts, as thesyntax element for the motion vector, the information about the motionvector difference and the information about the reference picture towhich the motion vector of the current block refers. When the videoencoding apparatus uses one of the plurality of predictive motion vectorcandidates as a predictive motion vector of the current block, thepredictive motion vector identification information is included in thebitstream. Therefore, in this case, not only the information about themotion vector difference and the reference picture but also thepredictive motion vector identification information is extracted as thesyntax element for the motion vector.

The decoder 310 extracts information about the quantized transformcoefficients of the current block as information about the residualsignal.

The inverse quantizer 320 inversely quantizes the quantized transformcoefficients. The inverse transformer 330 inversely transforms theinversely quantized transform coefficients from the frequency domain tothe spatial domain to reconstruct the residual signals, and therebygenerates a residual block for the current block.

The predictor 340 includes an intra-predictor 342 and an inter-predictor344. The intra-predictor 342 is activated when the prediction type ofthe current block is intra-prediction, and the inter-predictor 344 isactivated when the prediction type of the current block isinter-prediction.

The intra-predictor 342 determines an intra-prediction mode of thecurrent block among the plurality of intra-prediction modes using thesyntax element for the intra-prediction mode extracted from the decoder310, and predicts the current block using reference pixels around thecurrent block according to the intra-prediction mode.

The inter-predictor 344 determines motion information about the currentblock using the syntax element for the inter-prediction informationextracted from the decoder 310, and predicts the current block using thedetermined motion information.

First, the inter-predictor 344 checks the mode information forinter-prediction extracted from the decoder 310. When the modeinformation indicates the merge mode, the inter-predictor 344 configuresa merge list including a predetermined number of merge candidates usingneighboring blocks of the current block. The inter-predictor 344configures the merge list in the same way as in the case of theinter-predictor 124 of the video encoding apparatus. Then, one mergecandidate is selected from among the merge candidates in the merge listusing the merge index information transmitted from the decoder 310. Themotion information about the selected merge candidate, that is, themotion vector and the reference picture of the merge candidate, is setas a motion vector and a reference picture of the current block.

On the other hand, when the mode information indicates the motion vectordifference encoding mode, the inter-predictor 344 derives predictivemotion vector candidates using the motion vectors of the neighboringblocks of the current block, and determines a predictive motion vectorfor the motion vector of the current block using the predictive motionvector candidates. The inter-predictor 344 derives the predictive motionvector candidates in the same manner as in the case of theinter-predictor 124 of the video encoding apparatus. In the case wherethe video encoding apparatus uses one of the plurality of predictivemotion vector candidates as the predictive motion vector of the currentblock, the syntax element for the motion information includes predictivemotion vector identification information. Therefore, in this case, theinter-predictor 344 may select a candidate indicated by the predictivemotion vector identification information among the predictive motionvector candidates as the predictive motion vector. However, when thevideo encoding apparatus determines the predictive motion vector byapplying a predefined function to the plurality of predictive motionvector candidates, the inter-predictor 344 may determine the predictivemotion vector using the same function as used by the video encodingapparatus. Once the predictive motion vector of the current block isdetermined, the inter-predictor 344 adds the predictive motion vectorand the motion vector difference transmitted from the decoder 310 todetermine the motion vector of the current block. The reference picturereferred to by the motion vector of the current block is determinedusing the information about the reference picture delivered from thedecoder 310.

When the motion vector and the reference picture of the current blockare determined in the merge mode or the motion vector differenceencoding mode, the inter-predictor 344 generates a prediction block forthe current block using a block at the position indicated by the motionvector in the reference picture.

In the case of bidirectional prediction, the inter-predictor 344 selectsa first reference picture and a second reference picture from referencepicture list 0 and reference picture list 1 using syntax elements forthe inter-prediction information, respectively, and determines first andsecond motion vectors referring to the respective reference pictures.Then, a first reference block is generated by the first motion vectorreferring to the first reference picture, and a second reference blockis generated by the second motion vector referring to the secondreference picture. A prediction block for the current block is generatedby averaging or weighted-averaging the first reference block and thesecond reference block.

In addition, the inter-predictor 344 may perform the bidirectionaloptical flow (BIO) process of the present disclosure to generate aprediction block of the current block through bidirectional prediction.In other words, after determining bidirectional motion vectors for thecurrent block, the inter-predictor 344 may generate a prediction blockfor the current block by motion compensation according the BIO processon a per pixel basis or a per subblock basis.

In motion compensation by bidirectional prediction, whether to apply theBIO process may be determined in various ways. Details of the BIOprocess and details of whether to apply the BIO process in the motioncompensation procedure will be described with reference to FIG. 4 andsubsequent drawings.

The adder 350 adds the residual block output from the inversetransformer and the prediction block output from the inter-predictor orintra-predictor to reconstruct the current block. The pixels in thereconstructed current block are utilized as reference samples forintra-prediction of a block to be decoded later.

The filter unit 360 deblock-filters the boundaries between thereconstructed blocks in order to remove blocking artifacts caused byblock-by-block decoding and stores the deblock-filtered blocks in thememory 370. When all the blocks in one picture are reconstructed, thereconstructed picture is used as a reference picture forinter-prediction of blocks in a subsequent picture to be decoded.

The encoding apparatus performs motion estimation and compensation in acoding unit (CU) in an inter-prediction operation, and then transmits aresulting motion vector (MV) value to the decoding apparatus. Theencoding apparatus and the decoding apparatus may further correct the MVvalue in a pixel unit or a subblock unit (i.e., sub-CU) smaller than theCU using the BIO. That is, the BIO may precisely compensate for motionof the coding block CU in the unit of a 1×1 block (that is, one pixel)or the n×n block. In addition, since the BIO process is performed byapplying an explicit equation using pre-decoded information sharedbetween the encoding apparatus and the decoding apparatus, signaling ofadditional information for the BIO process from the encoding apparatusto the decoding apparatus is not required.

FIG. 4 is a reference diagram for explaining the basic concept of BIO.

The BIO used for video encoding and decoding is based on the assumptionthat the motion vector information should be bi-prediction information,and pixels constituting an image move at a constant speed and there islittle change in pixel values.

First, suppose that bidirectional motion vectors MV₀ and MV₁ have beendetermined by (normal) bidirectional motion prediction for the currentblock to be encoded in the current picture. The bidirectional motionvectors MV₀ and MV₁ point to corresponding regions (i.e., referenceblocks), in the reference pictures Ref₀ and Ref₁, most similar to thecurrent block. The two bidirectional motion vectors have valuesrepresenting the motion of the current block. That is, the bidirectionalmotion vectors are values obtained by setting a current block as oneunit and estimating the motion of the whole unit.

In the example of FIG. 4 , a pixel in the reference picture Ref₀indicated by the motion vector MV₀ and corresponding to pixel P in thecurrent block is denoted as P₀, and a pixel in the reference pictureRef₁ indicated by the motion vector MV₁ and corresponding to pixel P inthe current block denoted as P₁. Further, suppose that motion for pixelP in FIG. 4 is slightly different from the overall motion of the currentblock. For example, when an object located at pixel A in Ref₀ of FIG. 4moves to pixel B in Ref₁ via pixel P in current block of the currentpicture, pixel A and pixel B may have values quite similar to eachother. Also, in this case, the point in Ref₀ most similar to pixel P inthe current block is not P₀ indicated by the motion vector MV₀, butpixel A which is shifted from P₀ by a predetermined displacement vector(v_(x)τ₀, v_(y)τ₀). The point in Ref₁ most similar to pixel P in thecurrent block is not P₁ indicated by the motion vector MV₁, but pixel Bwhich is shifted from P₁ by a predetermined displacement vector(−v_(x)τ₁, −v_(y)τ₁). τ₀ and τ₁ denote time-domain distances for Ref₀and Ref₁ with respect to the current picture, respectively, and arecalculated based on picture order count (POC). Hereinafter, forsimplicity, (v_(x), v_(y)) is referred to as an “optical flow” or a “BIOmotion vector.”

Therefore, in predicting the value of pixel P of the current block inthe current picture, using the values of two reference pixels A and Benables more accurate prediction than using reference pixels P₀ and P₁indicated by the bidirectional motion vectors MV₀ and MV₁. The conceptof changing the reference pixels used to predict one pixel of thecurrent block in consideration of pixel-level motion specified by theoptical flow (v_(x), v_(y)) as described above may be extended to aconcept of considering subblock-level motion in units of subblocks splitfrom the current block.

Hereinafter, a theoretical method of generating a prediction value for apixel in a current block according to the BIO technique will bedescribed. For simplicity, it is assumed that BIO-based bidirectionalmotion compensation is performed on a pixel basis.

It is assumed that bidirectional motion vectors MV₀ and MV₁ pointing tocorresponding regions (i.e., reference blocks) most similar to thecurrent block encoded in the current picture have been determined in thereference pictures Ref₀ and Ref₁ by (normal) bidirectional motionprediction for the current block. The decoding apparatus may determinethe bidirectional motion vectors MV₀ and MV₁ from the motion vectorinformation included in the bitstream. In addition, the luminance valueof a pixel in the reference picture Ref₀ indicated by the motion vectorsMV₀ and corresponding to the pixel (i, j) in the current block isdefined as I⁽⁰⁾(i, j), and the luminance value of a pixel in thereference picture Ref₁ indicated by the motion vectors MV₁ andcorresponding to the pixel (i, j) in the current block is defined asI⁽¹⁾(i, j).

The luminance value of pixel A in the reference picture Ref₀ indicatingthat the BIO motion vector (v_(x), v_(y)) corresponds to a pixel in thecurrent block may be defined as I⁽⁰⁾(i+v_(x)τ₀, j+v_(y)τ₀), and theluminance value of pixel B in the reference picture Ref₁ may be definedas I⁽¹⁾(i−v_(x)τ₁, j−v_(y)τ₁). Here, when linear approximation isperformed using only the first-order term of the Taylor series, A and Bmay be expressed as Equation 1.

$\begin{matrix}{\begin{matrix}{A = {I^{(0)}\left( {{i + {v_{x}\tau_{0}}},{j + {v_{y}\tau_{0}}}} \right)}} \\{\approx {{I^{(0)}\left( {i,j} \right)} + {v_{x}\tau_{0}{I_{x}^{(0)}\left( {i,j} \right)}} + {v_{y}\tau_{0}{I_{y}^{(0)}\left( {i,j} \right)}}}}\end{matrix}\begin{matrix}{B = {I^{(1)}\left( {{i - {v_{x}\tau_{1}}},{j - {v_{y}\tau_{1}}}} \right)}} \\{\approx {{I^{(1)}\left( {i,j} \right)} - {v_{x}\tau_{1}{I_{x}^{(1)}\left( {i,j} \right)}} - {v_{y}\tau_{1}{I_{y}^{(1)}\left( {i,j} \right)}}}}\end{matrix}} & \left\lbrack {{Equation}1} \right\rbrack\end{matrix}$

Here, I_(x) ^((k)) and I_(y) ^((k)) (k=0, 1) are gradient values in thehorizontal and vertical directions at position (i, j) of Ref₀ and Ref₁.τ0 and τ₁ denote time-domain distances for Ref₀ and Ref₁ with respect tothe current picture, respectively, and are calculated based on POC:τ₀=POC(current)−POC(Ref0), τ₁=POC(Ref1)−POC(current).

The bidirectional optical flow (v_(x), v_(y)) of each pixel in a blockis determined as a solution that minimizes Δ, which is defined as adifference between pixel A and pixel B. Δ may be defined by Equation 2using the linear approximation of A and B derived from Equation 1.

$\begin{matrix}\begin{matrix}{\Delta = {A - B}} \\{= {\left( {I^{(0)} - I^{(1)}} \right) + {v_{x}\left( {{\tau_{0}I_{x}^{(0)}} + {\tau_{1}I_{x}^{(1)}}} \right)} +}} \\{v_{y}\left( {{\tau_{0}I_{y}^{(0)}} + {\tau_{1}I_{y}^{(1)}}} \right)}\end{matrix} & \left\lbrack {{Equation}2} \right\rbrack\end{matrix}$

For simplicity, the position (i, j) of a pixel is omitted from each termof Equation 2 above.

To implement more robust optical flow estimation, it is assumed that themotion is locally consistent with neighboring pixels. For the BIO motionvector for a pixel (i, j) that is currently to be predicted, thedifferences Δ in Equation 2 for all pixels (i′, j′) present in a mask Ωwhose size is (2M+1)×(2M+1) centered on the pixel (i, j) that iscurrently to be predicted are considered. That is, the optical flow forthe current pixel (i, j) may be determined as a vector that minimizesthe objective function Φ(v_(x), v_(y)), which is the sum of squares ofthe differences Δ[i′, j′] obtained for the respective pixels in the maskΩ, as shown in Equation 3.

$\begin{matrix}{{\Phi\left( {v_{x},v_{y}} \right)} = {\sum\limits_{{\lbrack{i^{\prime},j^{\prime}}\rbrack} \in \Omega}{\Delta^{2}\left\lbrack {i^{\prime},j^{\prime}} \right\rbrack}}} & \left\lbrack {{Equation}3} \right\rbrack\end{matrix}$

Here, (i′, j′) denotes the positions of the pixels in the mask Ω. Forexample, when M=2, the mask has a shape as shown in FIG. 5 . The pixelin the hatched area located at the center of the mask is the currentpixel (i, j), and the pixels in the mask are represented by (i′, j′).

In order to estimate the optical flow (v_(x), v_(y)) of each pixel (i,j) in the block, a solution which minimizes the objective functionΦ(v_(x), v_(y)) is calculated by an analytical method. ∂Φ(v_(x),v_(y))/∂v_(x)=0 and ∂Φ(v_(x), v_(y))/∂v_(y)=0 may be derived by partialderivatives of the objective function Φ(v_(x), v_(y)) with respect tov_(x) and v_(y), and Equation 4 may be obtained by solving the twoequations as simultaneous equations.s ₁ v _(x)(i, j)+s ₂ v _(y)(i, j)=−s ₃s ₄ v _(x)(i, j)+s ₅ v _(y)(i, j)=−s ₆   [Equation 4]

In Equation 4, s₁, s₂, s₃, s₄, s₅, and s₆ are given as shown in Equation5.

$\begin{matrix}{{s_{1} = {\sum\limits_{{\lbrack{i^{\prime},j^{\prime}}\rbrack} \in \Omega}\left\{ \left( {{\tau_{0}{I_{x}^{(0)}\left( {i^{\prime},j^{\prime}} \right)}} + {\tau_{1}{I_{x}^{(1)}\left( {i^{\prime},j^{\prime}} \right)}}} \right)^{2} \right\}}}{s_{2} = {\sum\limits_{{\lbrack{i^{\prime},j^{\prime}}\rbrack} \in \Omega}\left\{ {\left( {{\tau_{0}{I_{x}^{(0)}\left( {i^{\prime},j^{\prime}} \right)}} + {\tau_{1}{I_{x}^{(1)}\left( {i^{\prime},j^{\prime}} \right)}}} \right)\left( {{\tau_{0}{I_{y}^{(0)}\left( {i^{\prime},j^{\prime}} \right)}} + {\tau_{1}{I_{y}^{(1)}\left( {i^{\prime},j^{\prime}} \right)}}} \right)} \right\}}}{s_{3} = {- {\sum\limits_{{\lbrack{i^{\prime},j^{\prime}}\rbrack} \in \Omega}\left\{ {\left( {{\tau_{0}{I_{x}^{(0)}\left( {i^{\prime},j^{\prime}} \right)}} + {\tau_{1}{I_{x}^{(1)}\left( {i^{\prime},j^{\prime}} \right)}}} \right)\left( {{I^{(0)}\left( {i^{\prime},j^{\prime}} \right)} - {I^{(1)}\left( {i^{\prime},j^{\prime}} \right)}} \right)} \right\}}}}{s_{4} = {\sum\limits_{{\lbrack{i^{\prime},j^{\prime}}\rbrack} \in \Omega}\left\{ {\left( {{\tau_{0}{I_{x}^{(0)}\left( {i^{\prime},j^{\prime}} \right)}} + {\tau_{1}{I_{x}^{(1)}\left( {i^{\prime},j^{\prime}} \right)}}} \right)\left( {{\tau_{0}{I_{y}^{(0)}\left( {i^{\prime},j^{\prime}} \right)}} + {\tau_{1}{I_{y}^{(1)}\left( {i^{\prime},j^{\prime}} \right)}}} \right)} \right\}}}{s_{5} = {\sum\limits_{{\lbrack{i^{\prime},j^{\prime}}\rbrack} \in \Omega}\left\{ \left( {{\tau_{0}{I_{y}^{(0)}\left( {i^{\prime},j^{\prime}} \right)}} + {\tau_{1}{I_{y}^{(1)}\left( {i^{\prime},j^{\prime}} \right)}}} \right)^{2} \right\}}}{s_{6} = {- {\sum\limits_{{\lbrack{i^{\prime},j^{\prime}}\rbrack} \in \Omega}\left\{ {\left( {{\tau_{0}{I_{y}^{(0)}\left( {i^{\prime},j^{\prime}} \right)}} + {\tau_{1}{I_{y}^{(1)}\left( {i^{\prime},j^{\prime}} \right)}}} \right)\left( {{I^{(0)}\left( {i^{\prime},j^{\prime}} \right)} - {I^{(1)}\left( {i^{\prime},j^{\prime}} \right)}} \right)} \right\}}}}} & \left\lbrack {{Equation}5} \right\rbrack\end{matrix}$

Here, since s₂=s₄, s₄ is replaced by s₂.

By solving Equation 4, which is the system of equations, v_(x) and v_(y)may be estimated. For example, using Cramer's rule, v_(x) and v_(y) maybe derived as Equation 6.

$\begin{matrix}{{{v_{x}\left( {i,j} \right)} = {- \frac{{s_{3}s_{5}} - {s_{2}s_{6}}}{{s_{1}s_{5}} - s_{2}^{2}}}}{{v_{y}\left( {i,j} \right)} = {- \frac{{s_{1}s_{6}} - {s_{3}s_{2}}}{{s_{1}s_{5}} - s_{2}^{2}}}}} & \left\lbrack {{Equation}6} \right\rbrack\end{matrix}$

As another example, a simplified method of calculating an approximationof v_(x) by substituting v_(y)=0 into the first equation of Equation 4,and an approximation of v_(y) by substituting the calculated value ofv_(x) into the second equation may be used. In this case, v_(x) andv_(y) are expressed as shown in Equation 7.

$\begin{matrix}{{{{v_{x}\left( {i,j} \right)} = {- \frac{s_{3}}{s_{1} + r}}},{{s_{1} + r} > m}}{{{v_{y}\left( {i,j} \right)} = {- \frac{s_{6} - {s_{2}v_{x}}}{s_{5} + r}}},{{s_{5} + r} > m},}} & \left\lbrack {{Equation}7} \right\rbrack\end{matrix}$

where r and m are normalization parameters introduced to avoidperforming division by 0 or a very small value. In Equation 7, whens₁+r>m is not satisfied, v_(x)(i, j)=0 is set. When s₅+r>m is notsatisfied, v_(y)(i, j)=0 is set.

As another example, an approximation of v_(x) may be calculated bysubstituting v_(y)=0 into the first equation of Equation 4, and anapproximation of v_(y) may be calculated by substituting v_(x)=0 intothe second equation. With this method, v_(x) and v_(y) may be calculatedindependently, and may be expressed as Equation 8.

$\begin{matrix}{{{{v_{x}\left( {i,j} \right)} = {- \frac{s_{3}}{s_{1} + r}}},{{s_{1} + r} > m}}{{{v_{y}\left( {i,j} \right)} = {- \frac{s_{6}}{s_{5} + r}}},{{s_{5} + r} > m}}} & \left\lbrack {{Equation}8} \right\rbrack\end{matrix}$

As another example, an approximation of v_(x) may be calculated bysubstituting v_(y)=0 into the first equation of Equation 4, and v_(y)may be calculated as the average of a first approximation of v_(y)obtained by substituting the approximation of v_(x) into the secondequation and a second approximation of v_(y) obtained by substitutingv_(x)=0 into the second equation. Using this method, v_(x) and v_(y) areobtained as shown in Equation 9.

$\begin{matrix}{{{{v_{x}\left( {i,j} \right)} = {- \frac{s_{3}}{s_{1} + r}}},{{s_{1} + r} > m}}{{{v_{y}\left( {i,j} \right)} = {- \frac{s_{6} - {s_{2}{v_{x}/2}}}{s_{5} + r}}},{{s_{5} + r} > m}}} & \left\lbrack {{Equation}9} \right\rbrack\end{matrix}$

The normalization parameters r and m used in Equations 7 to 9 may bedefined as in Equation 10.r=500·4^(d−8)m=700·4^(d−8)   [Equation 10]

Here, d denotes the bit depth of the pixels of an image.

The optical flows v_(x) and v_(y) of the respective pixels in a blockare obtained by calculation using Equations 6 to 9 for each pixel in theblock.

Once the optical flow (v_(x), v_(y)) of the current pixel is determined,a bidirectional prediction value pred_(BIO) for the current pixel (i, j)according to the BIO may be calculated by Equation 11.pred_(BIO)=½·(I ⁽⁰⁾ +I ⁽¹⁾ +v _(x)(τ₀ ∂I _(x) ⁽⁰⁾−τ₁ ∂I _(x) ⁽¹⁾)+v_(y)(τ₀ ∂I _(y) ⁽⁰⁾−τ₁ ∂I _(y) ⁽¹⁾)), orpred_(BIO)=½·(I ⁽⁰⁾ +I ⁽¹⁾ +v _(x)/2(τ₁ ∂I _(x) ⁽¹⁾−τ₀ ∂I _(x) ⁽⁰⁾)+v_(y)/2(τ₁ ∂I _(y) ⁽¹⁾−τ₀ ∂I _(y) ⁽⁰⁾)   [Equation 11]

In Equation 11, (I⁽⁰⁾+I⁽¹⁾)/2 is typical bidirectional motioncompensation on a block basis, and therefore the remaining terms may bereferred to as BIO offsets.

In typical bidirectional motion compensation, a prediction block of thecurrent block is generated using the pixels in the reference block. Onthe other hand, to use a mask, access to pixels other than the pixels inthe reference block should be allowed. For example, the mask for thepixel at the top leftmost position (position (0, 0)) of a referenceblock as shown in FIG. 6(a) includes pixels located at positions outsidethe reference block. In order to maintain the same memory access as intypical bidirectional motion compensation and to reduce thecomputational complexity of the BIO, I^((k)), I_(x) ^((k)), and I_(y)^((k)) of pixels outside the reference block which are positioned withinthe mask may be padded with the corresponding values of the closestpixel in the reference block. For example, as shown in FIG. 6(b), whenthe size of the mask is 5×5, I^((k)), I_(x) ^((k)), and I_(y) ^((k)) ofexternal pixels located above the reference block may be padded withI^((k)), I_(x) ^((k)), and I_(y) ^((k)) of the pixels in the top row ofthe reference block. I^((k)), I_(x) ^((k)), and I_(y) ^((k)) of externalpixels on the left side of the reference block may be padded withI^((k)), I_(x) ^((k)), and I_(y) ^((k)) of the pixels in the leftmostcolumn of the reference block.

The BIO process on the basis of pixels in the current block has beendescribed. However, to reduce computational complexity, the BIO processmay be performed on a block basis, for example, on a 4×4 block basis.With the BIO carried out on a per subblock basis in the current block,optical flows v_(x) and v_(y) may be obtained on a per subblock basis inthe current block using Equations 6 to 9. The subblock-based BIO isbased on the same principle as the pixel-based BIO, except for the rangeof the mask.

As an example, the range of the mask Ω may be extended to include therange of a subblock. When the size of the subblock is N×N, the size ofthe mask Ω is (2M+N)×(2M+N). For example, when M=2 and the size of thesubblock is 4×4, the mask has a shape as shown in FIG. 7 . Δs ofEquation 2 may be calculated for all pixels in the mask Ω including thesubblock to obtain the objective function of Equation 3 for thesubblock, and the optical flows (v_(x), v_(y)) may be calculated on thesubblock basis by applying Equations 4 to 9.

As another example, Δs of Equation 2 may be calculated by applying amask to all pixels in the subblock on a pixel-by-pixel basis, and theobjective function of Equation 3 for the subblock may be obtained byobtaining the sum of squares of Δs. Then, the optical flow (v_(x),v_(y)) for the subblock may be calculated in such a manner as tominimize the objective function. For example, referring to FIG. 8 , Δsof Equation 2 may be calculated for all pixels in a 5×5 mask 810 a byapplying the mask 810 a to the pixel at position (0, 0) of a 4×4subblock 820 in the current block. Then, Δs of Equation 2 may becalculated for all pixels in a 5×5 mask 810 b by applying the mask 810 bto the pixel at position (0, 1). Through this process, the objectivefunction of Equation 3 may be obtained by summing the squares of thecalculated Δs for all the pixels in the subblock. Then, an optical flow(v_(x), v_(y)) that minimizes the objective function may be calculated.In this example, the objective function is expressed as Equation 12.

$\begin{matrix}{{{\Phi\left( {v_{x},v_{y}} \right)} = {\sum\limits_{{({x,y})} \in b_{k}}{\sum\limits_{{\lbrack{i^{\prime},j^{\prime}}\rbrack} \in {\Omega({x,y})}}{\Delta^{2}\left( {i^{\prime},j^{\prime}} \right)}}}},} & \left\lbrack {{Equation}12} \right\rbrack\end{matrix}$

where b_(k) denotes a k-th subblock in the current block, and Ω(x, y)denotes a mask for a pixel having coordinates (x, y) in the k-thsubblock. s₁ to s₆, which are used for calculation of an optical flow(v_(x), v_(y)), is modified as in Equation 13.

$\begin{matrix}{{{s_{1,b_{k}} = {\sum\limits_{{({x,y})} \in b_{k}}{\sum\limits_{{\lbrack{i^{\prime},j}\rbrack} \in {\Omega({x,y})}}\left( {{\tau_{1}{{\partial I^{(1)}}/{\partial x}}} + {\tau_{0}{{\partial I^{(0)}}/{\partial x}}}} \right)^{2}}}};}{{s_{3,b_{k}} = {\sum\limits_{{({x,y})} \in b_{k}}{\sum\limits_{{\lbrack{i^{\prime},j}\rbrack} \in \Omega}{\left( {I^{(1)} - I^{(0)}} \right)\left( {{\tau_{1}{{\partial I^{(1)}}/{\partial x}}} + {\tau_{0}{{\partial I^{(0)}}/{\partial x}}}} \right)}}}};}{{s_{2,b_{k}} = {\sum\limits_{{({x,y})} \in b_{k}}{\sum\limits_{{\lbrack{i^{\prime},j}\rbrack} \in \Omega}{\left( {{\tau_{1}{{\partial I^{(1)}}/{\partial x}}} + {\tau_{0}{{\partial I^{(0)}}/{\partial x}}}} \right)\left( {{\tau_{1}{{\partial I^{(1)}}/{\partial y}}} + {\tau_{0}{{\partial I^{(0)}}/{\partial y}}}} \right)}}}};}{{s_{5,b_{k}} = {\sum\limits_{{({x,y})} \in b_{k}}{\sum\limits_{{\lbrack{i^{\prime},j}\rbrack} \in \Omega}\left( {{\tau_{1}{{\partial I^{(1)}}/{\partial x}}} + {\tau_{0}{{\partial I^{(0)}}/{\partial x}}}} \right)^{2}}}};}{s_{6,b_{k}} = {\sum\limits_{{({x,y})} \in b_{k}}{\sum\limits_{{\lbrack{i^{\prime},j}\rbrack} \in \Omega}{\left( {I^{(1)} - I^{(0)}} \right)\left( {{\tau_{1}{{\partial I^{(1)}}/{\partial y}}} + {\tau_{0}{{\partial I^{(0)}}/{\partial y}}}} \right)}}}}} & \left\lbrack {{Equation}13} \right\rbrack\end{matrix}$

In the equation above, ∂I^((k))/∂x and ∂I^((k))/∂y denote I_(x) ^((k))and I_(x) ^((k)), that is, a horizontal gradient and a verticalgradient, respectively.

As another example, a subblock-based mask as shown in FIG. 7 may be usedand a weight may be applied at each position of the mask. A higherweight is applied at a position closer to the center of the subblock.For example, referring to FIG. 8 , when the mask is applied on apixel-by-pixel basis in the subblock, Δs for the same position may beredundantly calculated. Most of the pixels located within the mask 810 acentered on the pixel at position (0, 0) of the subblock 820 are alsolocated within the mask 810 b centered on the pixel at position (1, 0)of the subblock 820. Therefore, Δs may be redundantly calculated.Instead of repeatedly calculating the overlap Δ, a weight may beassigned to each position in the mask according to the number ofoverlaps. For example, when M=2 and the size of the subblock is 4×4, aweighted mask as shown in FIG. 9 may be used. In this way, the operationof Equations 12 and 13 may be simplified, thereby reducing computationalcomplexity.

The pixel-based or subblock-based BIO described above requires a largeamount of computation. Therefore, a method for reducing the amount ofcomputation according to BIO is required in video encoding or decoding.For this purpose, the present disclosure proposes that the BIO processbe skipped in motion compensation when certain conditions are met.

FIG. 10 is a block diagram illustrating a configuration of a deviceconfigured to perform motion compensation by selectively applying a BIOprocess according to an embodiment of the present disclosure.

A motion compensation device 1000 described in this embodiment, whichmay be implemented in the inter predictor 124 of the video encodingapparatus and/or the inter predictor 344 of the video decodingapparatus, may include a reference block generator 1010, a skipdeterminer 1020, and a prediction block generator 1030. Each of thesecomponents may be implemented as a hardware chip or may be implementedas software, and one or more microprocessors may be implemented toexecute the functions of the software corresponding to the respectivecomponents.

The reference block generator 1010 generates a first reference blockusing a first motion vector referring to a first reference picture inreference picture list 0, and generates a second reference picture usinga second motion vector referring to a second reference picture inreference picture list 1.

The skip determiner 1020 determines whether to apply the BIO process inthe motion compensation procedure.

When it is determined by the skip determiner 1020 that the BIO processis skipped, the prediction block generator 1030 generates a predictionblock of a current block by typical motion compensation. That is, theprediction block of the current block is generated by averaging orweighted-averaging the first reference block and the second referenceblock. On the other hand, when it is determined by the skip determiner1020 that the BIO process is applied, the prediction block generator1030 generates a prediction block of the current block using the firstreference block and the second reference block according to the BIOprocess. That is, the prediction block of the current block may begenerated by applying Equation 11.

The skip determiner 1020 may determine whether to apply the BIO processbased on one or more of the following conditions:

Texture complexity of the current block;

Size of the current block and/or mode information indicating a motioninformation encoding mode;

Whether bidirectional motion vectors (first motion vector and secondmotion vector) satisfy a constant velocity constraint (CVC) and/or abrightness constancy constraint (BCC); and

Degree of variation of motion vectors of neighboring blocks.

Hereinafter, a detailed method of determining whether to apply the BIOprocess using each condition will be described.

Embodiment 1: BIO Skip According to Texture Complexity

Optical flow tends to yield a result that is not robust in smooth areaswhere there are few local features, such as edges or corners. Inaddition, it is likely that an area having such a smooth texture hasalready been sufficiently predicted through conventional block-basedmotion estimation. Therefore, in the present embodiment, texturecomplexity of the current block is calculated and the BIO process isskipped depending on the texture complexity.

To allow the encoding apparatus and the decoding apparatus to calculatethe texture complexity without additional signaling, the texturecomplexity of the current block may be calculated using the firstreference block and the second reference block shared between theencoding apparatus and the decoding apparatus. That is, the skipdeterminer implemented in each of the encoding apparatus and thedecoding apparatus determines whether to skip the BIO process bycalculating the texture complexity of the current block.

For the texture complexity, a local feature detector with a small amountof computation such as a difference from neighboring pixels, a gradient,and a Moravec may be used. In this embodiment, the texture complexity iscalculated using the gradient. The gradients for the reference blocksare values used in the BIO process. Accordingly, this embodiment has theadvantage that the gradient values calculated in the texture complexitycan be directly applied in carrying out the BIO process.

The motion compensation device 1000 according to this embodimentcalculates texture complexity using a horizontal gradient and a verticalgradient of each pixel in the first reference block and the secondreference block. As one example, the motion compensation device 1000calculates horizontal complexity using the horizontal gradients of therespective pixels in the first reference block and the second referenceblock, and calculates vertical complexity using the vertical gradientsof the respective pixels in the first reference block and the secondreference block. For example, the horizontal complexity and the verticalcomplexity may be calculated by Equation 14.

$\begin{matrix}{{D_{1} = {\sum\limits_{{\lbrack{i,j}\rbrack} \in {CU}}\left( {d_{1}\left( {i,j} \right)} \right)}}{{D_{5} = {\sum\limits_{{\lbrack{i,j}\rbrack} \in {CU}}\left( {d_{5}\left( {i,j} \right)} \right)}},}} & \left\lbrack {{Equation}14} \right\rbrack\end{matrix}$

where D₁ and D₅ denote horizontal complexity and vertical complexity,respectively, and CU denotes a set of pixel positions in the firstreference block and the second reference block corresponding to thepositions of the respective pixels in the current block. [i, j] denotesa position in the first reference block and the second reference blockcorresponding to each pixel in the current block. And d₁(i, j) and d₅(i,j) may be calculated by Equation 15.d ₁=(I _(x) ⁽⁰⁾(i, j)+I _(x) ⁽¹⁾(i, j))²d ₂=(I _(x) ⁽⁰⁾(i, j)+I _(x) ⁽¹⁾(i, j))(I _(y) ⁽⁰⁾(i, j)+I _(y) ⁽¹⁾(i,j))d ₃=−(I _(x) ⁽⁰⁾(i, j)+I _(x) ⁽¹⁾(i, j))(I ⁽⁰⁾(i, j)−I ⁽¹⁾(i, j))d ₅=(i _(y) ⁽⁰⁾(i, j)+I _(y) ⁽¹⁾(i, j))²d ₆=−(i _(y) ⁽⁰⁾(i, j)+I _(y) ⁽¹⁾(i, j)(I ⁽⁰⁾(i, j)−I ⁽¹⁾(i, j))  [Equation 15]

Using d₁ and d₅ of Equation 15, the horizontal and vertical complexitiesmay be calculated in Equation 14. That is, the horizontal complexity D₁may be calculated by calculating the sum of horizontal gradients(τ₀I_(x) ⁽⁰⁾(i,j), τ₁I_(x) ⁽¹⁾(i,j)) for every pixel position inconsideration of the time-domain distances (τ₀,τ₁) for the pixels atpositions corresponding to each other in the first reference block andthe second reference block and summing the squares of the sums. Then,the vertical complexity D₅ may be calculated by calculating the sum ofvertical gradients (τ₀I_(y) ⁽⁰⁾(i,j), τ₁I_(y) ⁽¹⁾(i,j)) for every pixelposition in consideration of the time-domain distances for the pixels atpositions corresponding to each other in the first reference block andthe second reference block and summing the squares of the sums.

In Equation 15, d₄ is omitted. d₄ has the same value as d₂. It can beseen that d₁ to d₆ of Equation 15 are associated with s₁ to s₆ ofEquation 5. d₁ to d₆ represent values at one pixel position, and s₁ tos₆ represent the sum of each of d₁ to d₆ calculated at all pixelpositions in a mask centered on one pixel. That is, using Equation 15,Equation 5 may be expressed as Equation 16 below. In Equation 16, s₄ isomitted because s₄ has the same value as s₂.

$\begin{matrix}{{s_{1} = {\sum\limits_{{\lbrack{i^{\prime},j^{\prime}}\rbrack} \in \Omega}\left( {d_{1}\left( {i^{\prime},j^{\prime}} \right)} \right)}}{s_{2} = {\sum\limits_{{\lbrack{i^{\prime},j^{\prime}}\rbrack} \in \Omega}\left( {d_{2}\left( {i^{\prime},j^{\prime}} \right)} \right)}}{s_{3} = {\sum\limits_{{\lbrack{i^{\prime},j^{\prime}}\rbrack} \in \Omega}\left( {d_{3}\left( {i^{\prime},j^{\prime}} \right)} \right)}}{s_{5} = {\sum\limits_{{\lbrack{i^{\prime},j^{\prime}}\rbrack} \in \Omega}\left( {d_{5}\left( {i^{\prime},j^{\prime}} \right)} \right)}}{s_{6} = {\sum\limits_{{\lbrack{i^{\prime},j^{\prime}}\rbrack} \in \Omega}\left( {d_{6}\left( {i^{\prime},j^{\prime}} \right)} \right)}}} & \left\lbrack {{Equation}16} \right\rbrack\end{matrix}$

The texture complexity for the current block may be set to any of theminimum Min(D₁, D₅), the maximum Max(D₁, D₅), or the average Ave(D₁, D₅)of the horizontal complexity and the vertical complexity. The motioncompensation device 1000 skips the BIO process when the texturecomplexity is less than a threshold T, and applies the BIO process whenthe texture complexity is greater than or equal to the threshold T. Whenthe BIO process is applied, d₁ to d₆ calculated in Equation 14 may beused for calculation of s₁ to s₆. That is, according to this embodiment,the texture complexity of the current block is obtained using values tobe calculated during the BIO process and whether to skip the BIO processis determined based thereon. Accordingly, additional computation fordetermining whether to skip the BIO process may be reduced.

For the threshold T, a method of scaling the normalization parameterused in Equations 7 to 9 may be used. The normalization parameters r andm have relations of s₁>m−r and s₅>m−r. When s₁<=m−r, v_(x) is 0 even ifBIO is performed. When s₅<=m−r, v_(y) is 0 even if BIO is performed.

Therefore, when the threshold value T is set based on the relations ofthe normalization parameters, the BIO may be skipped by pre-determining,on a CU basis, a region that is set to 0 even if the BIO is performed.D₁ is the sum of d₁ for all pixel positions in the CU and s₁ is the sumof d₁ in the mask Ω. Therefore, when the size of the CU is W×H and thesize of the mask Ω is (2M+1)×(2M+1), the threshold T may be set as inEquation 17.

$\begin{matrix}{T = {\left( {m - r} \right) \times \frac{W \times H}{\left( {{2M} + 1} \right)^{2}}}} & \left\lbrack {{Equation}17} \right\rbrack\end{matrix}$

FIG. 11 is an exemplary diagram illustrating a procedure of performingmotion compensation by selectively applying the BIO process based ontexture complexity of a current block according to an embodiment of thepresent disclosure.

The motion compensation device 1000 calculates a horizontal gradientI_(x) ^((k)) and a vertical gradient I_(y) ^((k)) for each pixel in thefirst reference block and the second reference block (S1102). Then, d₁to d₆ are calculated using Equation 15, and horizontal complexity D₁ andvertical complexity D₅ are calculated according to Equation 14 using d₁and d₅ (S1104). It is determined whether the texture complexity of thecurrent block, which is the minimum between the horizontal complexity D₁and the vertical complexity D₅, is less than the threshold T (S1106).While the texture complexity of the current block is described in thisexample as being the minimum between the horizontal complexity D₁ andthe vertical complexity D₅, the texture complexity may be set to themaximum or average value.

When the texture complexity of the current block is less than thethreshold T, the BIO process is skipped and a prediction block of thecurrent block is generated by typical motion compensation (S1108). Thatis, the prediction block of the current block is generated by averagingor weighted-averaging the first reference block and the second referenceblock.

When the texture complexity of the current block is greater than orequal to the threshold T, the prediction block for the current block isgenerated using the first reference block and the second reference blockaccording to the BIO process. First, s₁ to s₆ are calculated. Since thehorizontal and vertical gradients for the pixels in the reference blockshave already been calculated in S1102, the horizontal and verticalgradients need to be calculated only for the pixels outside thereference block which are present in the mask to obtain s₁ to s₆.Alternatively, when the horizontal gradient and the vertical gradientfor the pixels outside the reference block are padded with correspondingvalues of pixels of the reference block close thereto as describedabove, s₁ to s₆ may be obtained using only the already-calculatedhorizontal and vertical gradients for the pixels in the referenceblocks.

Alternatively, since d₁ to d₆ are associated with s₁ to s₆ (see Equation16), the calculated values of d₁ to d₆ may be used in calculating s₁ tos₆.

Once s₁ to s₆ are calculated, a pixel-based or subblock-based opticalflow (v_(x), v_(y)) is determined using one of Equations 6 to 9 (S1112).Then, by applying the optical flow (v_(x), v_(y)) to the correspondingpixel or subblock in the current block, a prediction block of thecurrent block is generated according to Equation 11 (S1114).

FIG. 12 is another exemplary diagram illustrating a procedure ofperforming motion compensation by selectively applying the BIO processbased on texture complexity of a current block according to anembodiment of the present disclosure.

The example disclosed in FIG. 12 differs from the example of FIG. 11only in the order in which d₁ to d₆ are calculated. That is, only d₁ andd₅ among d₁ to d₆ are needed to calculate the texture complexity of thecurrent block. Therefore, as in S1204, d₁ and d₅ are obtained first. Andd₂, d₃, d₄ (equal to d₂), and d₆ are calculated when the texturecomplexity is greater than the threshold and thus the BIO process isperformed (S1210). Other operations are substantially the same as thosein FIG. 11 .

The table below shows an experimental result comparing motioncompensation according to the BIO process with motion compensationperformed by selectively applying the BIO process based on the texturecomplexity according to the present embodiment.

TABLE 1 Random Access Main 10 Over JEM-6 Y U V skip ratio Class A1 0.03%−0.12% −0.03% 32% Class B 0.02% −0.03% −0.01% 21% Class C 0.02% −0.01%−0.04% 12% Class D 0.02% 0.03% 0.01%  9% Overall (Ref) 0.02% −0.03%−0.01% 19%

The sequences used in the experiment were 4 for Class A1 (4K), 5 forClass B (FHD), 4 for Class C (832×480), and 4 for Class D (416×240), andthe experiment was conducted using all frames of the respective videos.The experimental environment was random access (RA) configuration, andthe BD rates were compared by conducting the experiment by setting theQP to 22, 27, 32, and 37.

According to the present embodiment, BIO was skipped by about 19% onaverage, and 32% of BIO was skipped in Class A1 (4K), which has thelargest amount of computation. The experiment showed that, as theresolution of the image increases, the ratio of skipping increases. Theresult of the experiment may be considered as significant becauseincrease in resolution substantially increases the burden in terms ofthe amount of computation.

In addition, although there was an increase of Y BD rate of 0.02% onaverage, a BD rate difference of 0.1% or less is generally considerednegligible. Accordingly, it may be seen that compression efficiency isalmost the same even if the BIO is selectively skipped according to thisexample.

The examples described above are related to determining whether to skipthe entire BIO process. Instead of skipping the entire BIO process, thehorizontal optical flow v_(x) and the vertical optical flow v_(y) may beindependently skipped. That is, the BIO process in the horizontaldirection is skipped by setting v_(x)=0 when the horizontal complexityD₁ is less than the threshold T, and the BIO process in the verticaldirection is skipped by setting v_(y)=0 when the vertical complexity D₅is less than the threshold T.

FIG. 13 is yet another exemplary diagram illustrating a procedure ofperforming motion compensation by selectively applying the BIO processbased on texture complexity of a current block according to anembodiment of the present disclosure.

The motion compensation device 1000 calculates a horizontal gradientI_(x) ^((k)) and a vertical gradient I_(y) ^((k)) for each pixel in thefirst reference block and the second reference block (S1310). Then, d₁and d₅ are calculated using Equation 15, horizontal complexity D₁ iscalculated using d₁, and vertical complexity D₅ is calculated using d₅(S1320).

Once the horizontal complexity D₁ and the vertical complexity D₅ arecalculated in S1320, an operation of determining whether to skip thehorizontal optical flow (S1330) and an operation of determining whetherto skip the vertical optical flow (S1340) are performed. While FIG. 13illustrates that whether to skip the horizontal optical flow isdetermined first, whether to skip the vertical optical flow may bedetermined first.

In S1330, the motion compensation device 1000 determines whether thehorizontal complexity D1 is less than the threshold T (S1331). When thehorizontal complexity D₁ is less than the threshold T, the horizontaloptical flow v_(x) is set to 0 (S1332). This means that the horizontaloptical flow is not applied. When the horizontal complexity D₁ isgreater than or equal to the threshold T, d₃ is calculated (S1333), ands₁ and s₃ are calculated using d₁ and d₃ (S1334). Referring to Equations7 to 9, when the horizontal optical flow v_(x) is calculated, only s1and s3 are required. Since d₁ has already been calculated in S1320, d₃is calculated in S1333 and s₁ and s₃ are calculated in S1334 using d₁and d₃. Then, the horizontal optical flow v_(x) is calculated using s₁and s₃ according to any one of Equations 7 to 9 (S1335).

Then, the process proceeds to S1340 to determine whether to skip thevertical direction optical flow. It is determined whether the verticalcomplexity D₅ is less than the threshold T (S1341). When the verticalcomplexity D₅ is less than the threshold T, the vertical optical flowv_(y) is set to 0 (S1342). This means that the vertical optical flow isnot applied. When the vertical complexity D₅ is greater than or equal tothe threshold T, d₂ and d₆ are calculated (S1343), and s₂, s₅, and s₆are calculated using d₂, d₅, and d₆ (S1344). When the vertical opticalflow v_(y) is calculated using Equation 7 or 9, only s₂, s₅, and s₆ arerequired. Since d₅ has already been calculated in S1320, d₂ and d₆ arecalculated in S1343, and s₂, s₅, and s₆ are calculated in S1344 usingd₂, d₅, and d₆. Then, the vertical optical flow v_(y) is calculatedusing s₂, s₅, and s₆ according to Equation 7 or 9 (S1345).

When the vertical optical flow v_(y) is calculated using Equation 8,only s₅ and s₆ are required. In this case, therefore, calculation of d₂and s₂ may be omitted in S1343 and S1344.

Substituting the horizontal optical flow v_(x) and the vertical opticalflow v_(y) calculated in this way into Equation 11 produces a predictionblock of the current block. When the horizontal optical flow is skipped,v_(x)=0 in Equation 11, and therefore the horizontal optical flow v_(x)does not contribute to generating the prediction block. Similarly, whenthe vertical optical flow is skipped, v_(y)=0, and therefore thevertical optical flow v_(y) does not contribute to generating theprediction block. When both the horizontal and vertical optical flowsare skipped, v_(x)=0 and v_(y)=0, and therefore a prediction block isgenerated by averaging the first reference block and the secondreference block. That is, the prediction block is generated throughtypical motion compensation.

In Embodiment 1 described above, the texture complexity of the currentblock is estimated using the pixels in the reference block. However, thetexture complexity of the current block may be calculated using theactual pixels in the current block. For example, the encoding apparatusmay calculate the horizontal complexity and the vertical complexityusing the horizontal and vertical gradients of the pixels in the currentblock. That is, the horizontal complexity is calculated using the sum ofsquares of the horizontal gradients of the respective pixels in thecurrent block, and the vertical complexity is calculated using the sumof squares of the vertical gradients. The horizontal and verticalcomplexities are then used to determine whether to skip the BIO process.In this case, unlike the encoding apparatus, the decoding apparatus doesnot know the pixels in the current block. Accordingly, the decodingapparatus cannot calculate the texture complexity in the same manner asthe encoding apparatus. Therefore, the encoding apparatus shouldadditionally signal information indicating whether BIO is skipped to thedecoding apparatus. That is, the skip determiner implemented in thedecoding apparatus decodes the information indicating whether to skipthe BIO received from the encoding apparatus and selectively skips theBIO process as indicated by the information.

Embodiment 2: BIO Skip According to Size of Current Block and/or MotionInformation Encoding Mode

As described above, the CU corresponding to a leaf node of a treestructure, that is, the current block, may have various sizes accordingto the tree structure splitting from the CTU.

When the size of the current block is sufficiently small, the motionvector of the current block is likely to have a value substantiallysimilar to the pixel-based or subblock-based BIO, and thus thecompensation effect obtained by performing BIO may be small. In thiscase, decrease in complexity obtained by skipping the BIO is likely tobe a greater benefit than precision loss due to skipping the BIO.

As described above, the motion vector of the current block may beencoded in a merge mode or in a mode for encoding a motion vectordifference. When the motion vector of the current block is encoded inthe merge mode, the motion vector of the current block is merged withthe motion vector of a neighboring block. That is, the motion vector ofthe current block is set to equal to the motion vector of theneighboring block. In this case, an additional compensation effect maybe obtained through the BIO.

Accordingly, in the present embodiment, the BIO process is skipped basedon at least one of the size of the current block or the mode informationindicating the encoding mode of the motion vector.

FIG. 14 is an exemplary diagram illustrating a procedure of performingmotion compensation by selectively applying the BIO process based on thesize of the current block and an encoding mode of the motion vectoraccording to an embodiment of the present disclosure. Although FIG. 14illustrates that both the size of the current block and the encodingmode of the motion vector are used to determine whether to skip BIO isdetermined, using any one thereof is also within the scope of thepresent disclosure.

The motion compensation device 1000 first determines whether the size ofthe current block CU, which is a block to be encoded, is less than orequal to a threshold size (S1402). When the size of the current block CUis greater than the threshold size, a prediction block of the currentblock is generated according to the BIO process (S1408).

On the other hand, when the size of the current block CU is less than orequal to the threshold size, it is determined whether the motion vectorMV of the current block CU is encoded by the merge mode (S1404). Whenthe motion vector is not encoded by the merge mode, the BIO process isskipped and a prediction block of the current block is generated throughtypical motion compensation (S1406). When the motion vector is encodedby the merge mode, a prediction block of the current block is generatedaccording to the BIO process (S1408).

For example, when w_(t)×h_(t) is defined as 8×8, and the motion vectorof the current block having a size of 8×8, 8×4, 4×8, or 4×4, which isless than or equal to 8×8, is not encoded by the merge mode, the BIOprocess is skipped.

In generating the prediction block according to the BIO process inS1308, whether to skip the BIO may be further determined according toEmbodiment 1, that is, the texture complexity of the current block.

Embodiment 3: BIO Skip According to CVC and/or BCC

The BIO is based on the assumption that an object in the video moves ata constant velocity and that there is little change in pixel value.These assumptions are defined as a constant velocity constraint (CVC)and a brightness constancy constraint (BCC), respectively.

When the bidirectional motion vectors (MVx₀, MVy₀) and (MVx₁, MVy₁)estimated on a current block basis satisfy the two conditions of CVC andBCC, the BIO operating based on the same assumptions is also likely tohave values similar to the bidirectional motion vectors of the currentblock.

Satisfying the CVC condition by the bidirectional motion vectors (MVx₀,MVy₀) and (MVx₁, MVy₁) of the current block means that the two motionvectors have opposite signs and have the same motion displacement pertime.

Satisfying the BCC condition by the bidirectional motion vectors of thecurrent block means that the difference between a first reference blocklocated in a first reference picture Ref₀ indicated by (MVx₀, MVy₀) anda reference block located in a second reference picture Ref₁ indicatedby (MVx₁, MVy₁) is 0. The difference between the two reference blocksmay be calculated by sum of absolute differences (SAD), sum of squarederrors (SSE), or the like.

As an example, the CVC condition and the BCC condition may be expressedas follows.|MVx ₀/τ₀+MVx ₁/τ₁ |<T _(CVC) & |MVy ₀/τ₀+MVy ₁/τ₁ |<T _(CVC) Σ_((i,j))|I ⁽⁰⁾(i+MVx ₀ , j+MVy ₀)−I ⁽¹⁾(i+MVx ₁ , j+MVy ₁)|<T _(BCC),  [Equation 18]

where T_(CVC) and T_(BCC) are thresholds of the CVC condition and theBCC condition, respectively.

Referring to FIG. 4 , the BIO assumes that an optical flow (+v_(x),+v_(y)) for the first reference picture Ref₀ and an optical flow(−v_(x), −v_(y)) for the second reference picture Ref₁ have the samemagnitude but different signs. Therefore, in order for the bidirectionalmotion vectors (MVx₀, MVy₀) and (MVx₁, MVy₁) to satisfy the BIOassumption, the x components MVx₀ and MVx₁ of the bidirectional motionvectors should have different signs, and the y components MVy₀ and MVy₁should also have different signs. In addition, in order to satisfy theCVC condition, the absolute value of MVx₀ divided by τ₀, which is thetime-domain distance between the current picture and the first referencepicture, should be equal to the absolute value of MVx₁ divided by τ₁,which is the time-domain distance between the current picture and thesecond reference picture. Similarly, the absolute value of MVy₀ dividedby τ₀ and the absolute value of MVy₁ divided by τ₁ should be equal toeach other. Therefore, based on the concept of a threshold, the CVCcondition as given above may be derived.

The BCC condition is satisfied when the SAD between the reference blocksthat the bidirectional motion vectors (MVx₀, MVy₀) and (MVx₁, MVy₁)refer to, respectively, is less than or equal to a threshold T_(BCC). Ofcourse, other indicators that may represent the difference between tworeference blocks, such as SSE, may be used instead of SAD.

FIG. 15 is an exemplary diagram illustrating a procedure of performingmotion compensation by selectively applying the BIO process based on theCVC condition and the BCC condition according to an embodiment of thepresent disclosure.

The motion compensation device 1000 determines whether the bidirectionalmotion vectors (MVx₀, MVy₀) and (MVx₁, MVy₁) of the current blocksatisfy the CVC condition and the BCC condition (S1502). When bothconditions are met, the BIO process is skipped and a prediction block isgenerated according to typical motion compensation (S1504).

On the other hand, when any one of the two conditions is not satisfied,a prediction block of the current block is generated according to theBIO process (S1506).

While FIG. 15 illustrates that the BIO process is skipped when both theCVC condition and the BCC condition are satisfied, this is merely anexample. Whether to skip BIO may be determined based on one of the CVCcondition and the BCC condition.

Embodiment 4: BIO Skip According to the Degree of Variation of MotionVectors of Neighboring Blocks

When the bidirectional motion vectors estimated on a per block basis inthe neighboring blocks of the current block have similar values, theoptical flows estimated on a per pixel basis or per subblock basis inthe current block are also likely to have similar values.

Therefore, whether to skip the BIO of the current block may bedetermined based on the degree of variation of the motion vectors of theneighboring blocks, for example, variance or standard deviation. As anextreme example, when the variance of motion vectors of the neighboringblocks is 0, the optical flows on a per pixel basis or per subblockbasis in the current block are also likely to have the same value as themotion vector of the current block, and thus the BIO is skipped.

As an example, the motion vector variance of the neighboring blocks maybe expressed as Equation 19.

$\begin{matrix}{{{VAR}_{MV} = {{VAR}_{x} + {VAR}_{y}}}{{VAR}_{x} = {\sum\limits_{{({m,n})} \in L}{❘{{MVx}_{t({m,n})} - {\frac{1}{l}{\sum\limits_{{({m,n})} \in L}{MVx}_{t({m,n})}}}}❘}}}{{{VAR}_{y} = {\sum\limits_{{({m,n})} \in L}{❘{{MVy}_{t({m,n})} - {\frac{1}{l}{\sum\limits_{{({m,n})} \in L}{MVy}_{t({m,n})}}}}❘}}},}} & \left\lbrack {{Equation}19} \right\rbrack\end{matrix}$

where L is a set of neighboring blocks and I is the total number ofneighboring blocks. (m, n) denotes the indexes of the neighboring blocksand t ∈(0, 1).

FIG. 16 is an exemplary diagram illustrating a procedure of performingmotion compensation by selectively applying the BIO process based on amotion vector variance of neighboring blocks according to an embodimentof the present disclosure.

The motion compensation device 1000 compares the variance of the motionvectors of the neighboring blocks with a predetermined threshold(S1602). When the motion vector variance of the neighboring blocks isless than the threshold, the BIO process is skipped and a predictionblock is generated according to the typical motion compensation (S1604).On the other hand, when the motion vector variance of the neighboringblocks is greater than the threshold, a prediction block of the currentblock is generated according to the BIO process (S1606).

In Embodiments 1 to 4, determining whether to skip the BIO using eachcondition individually has been described. However, the presentdisclosure is not limited to determining whether to skip the BIO usingany one condition. Determining whether to skip the BIO by selectivelycombining the multiple conditions described in the present disclosureshould also be construed as being within the scope of the presentdisclosure. For example, selectively combining various methods describedin the present disclosure, such as determining whether to skip the BIObased on the size and texture complexity of the current block,determining whether to skip the BIO based on the size of the currentblock, the CVC condition and/or the BCC condition, and determiningwhether to skip of the BIO based on one or more of the CVC condition andthe BCC condition and the texture complexity of the current block,should be construed as being within the scope of the present disclosure.

Although exemplary embodiments have been described for illustrativepurposes, those skilled in the art will appreciate that and variousmodifications and changes are possible, without departing from the ideaand scope of the embodiments. Exemplary embodiments have been describedfor the sake of brevity and clarity. Accordingly, one of ordinary skillwould understand that the scope of the embodiments is not limited by theexplicitly described above embodiments but is inclusive of the claimsand equivalents thereto.

What is claimed is:
 1. A video encoding method for predicting a targetblock using a bi-directional optical flow, the method comprising:determining the target block, by partitioning a pre-determined size ofblock in a tree structure; generating a first motion vector for a firstreference picture and a second motion vector for a second referencepicture; deriving a variable from sample value differences betweensamples in the first reference picture which are determined based on thefirst motion vector and samples in the second reference picture whichare determined based on the second motion vector, wherein the variableis SAD (Sum of Absolute Differences) or SSE (Sum of Squared Errors) andis used for determining whether to apply the bi-directional opticalflow; generating a prediction block of the target block from the firstand second reference pictures, by selectively either applying orskipping the bi-directional optical flow depending on the variable; andencoding partition information related to the tree structure, andresidual signals that are differences between samples in the targetblock and samples in the prediction block, wherein the bi-directionaloptical flow is performed by the unit of samples in the target block orby the unit of sub-blocks partitioned from the target block.
 2. Theapparatus of claim 1, wherein the bi-directional optical flow is skippedwhen the variable is less than a predetermined threshold, and is appliedwhen the variable is greater than the predetermined threshold.
 3. Theapparatus of claim 1, wherein, when at least one of a width or a heightof the target block is less than a predetermined length, thebi-directional optical flow is skipped.
 4. The apparatus of claim 3,wherein the predetermined length is
 8. 5. A video decoding apparatus forpredicting a target block using a bi-directional optical flow, theapparatus comprising one or more processor configured to: decodepartition information from a bitstream, and determine the target blockby partitioning a pre-determined size of block in a tree structure;reconstruct residual signals corresponding to the target block from thebitstream; generate a first motion vector for a first reference pictureand a second motion vector for a second reference picture; derive avariable from sample value differences between samples in the firstreference picture which are determined based on the first motion vectorand samples in the second reference picture which are determined basedon the second motion vector, wherein the variable is SAD (Sum ofAbsolute Differences) or SSE (Sum of Squared Errors) and is used fordetermining whether to apply the bi-directional optical flow; generate aprediction block of the target block from the first and second referencepictures, by selectively either applying or skipping the bi-directionaloptical flow depending on the variable; and reconstruct the target blockby using samples in the prediction block and the residual signals,wherein the bi-directional optical flow is performed by the unit ofsamples in the target block or by the unit of sub-blocks partitionedfrom the target block.
 6. The method of claim 5, wherein thebi-directional optical flow is skipped when the variable is less than apredetermined threshold, and is applied when the variable is greaterthan the predetermined threshold.
 7. The method of claim 5, wherein,when at least one of a width or a height of the target block is lessthan a predetermined length, the bi-directional optical flow is skipped.8. The method of claim 7, wherein the predetermined length is
 8. 9. Anon-transitory recording medium storing a bitstream generated by a videoencoding method for predicting a target block using a bi-directionaloptical flow, the method comprising: determining the target block, bypartitioning a pre-determined size of block in a tree structure;generating a first motion vector for a first reference picture and asecond motion vector for a second reference picture; deriving a variablefrom sample value differences between samples in the first referencepicture which are determined based on the first motion vector andsamples in the second reference picture which are determined based onthe second motion vector, wherein the variable is SAD (Sum of AbsoluteDifferences) or SSE (Sum of Squared Errors) and is used for determiningwhether to apply the bi-directional optical flow; generating aprediction block of the target block from the first and second referencepictures, by selectively either applying or skipping the bi-directionaloptical flow depending on the variable; and encoding partitioninformation related to the tree structure, and residual signals that aredifferences between samples in the target block and samples in theprediction block, wherein the bi-directional optical flow is performedby the unit of samples in the target block or by the unit of sub-blockspartitioned from the target block.